<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SilverlightTextEditor">


    <Style TargetType="local:RTB">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RTB">
                    <Border>
                        <Grid x:Name="LayoutRoot" Background="#FF7297C5">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="DragStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0:0:0.3">
                                            <VisualTransition.GeneratedEasingFunction>
                                                <CircleEase EasingMode="EaseIn"/>
                                            </VisualTransition.GeneratedEasingFunction>
                                        </VisualTransition>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="DragOver">
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)" Storyboard.TargetName="rtb">
                                                <EasingColorKeyFrame KeyTime="0" Value="#FFFFF7D1"/>
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path Name="Path1" Data="M0,53 L2,184 C2,184 245,46 509,52 L526,0 z" Margin="-20,-61,294,0" StrokeThickness="1" UseLayoutRounding="False" VerticalAlignment="Top" Height="184" Fill="#FF97B6DC" Opacity="0.8" />
                            <Path Name="Path2" Data="M29,77 L0,185 C0,185 329,32 652,71 L515,0 z" Margin="-29,-76,177,0" StrokeThickness="1" UseLayoutRounding="False" VerticalAlignment="Top" Height="185"  Fill="#FFA1C2ED" Opacity="0.8"/>
                            <Image Name="SLLogo" HorizontalAlignment="Center" VerticalAlignment="Top" Source="Images/logo.png" Stretch="None" Margin="-550,9,0,0"/>
                            <Border x:Name="ApplicationBorder" MaxWidth="900" Margin="0,50,0,10" Grid.RowSpan="1" BorderThickness="1" BorderBrush="#FF646464">
                                <Grid Name="MainGrid">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="60" />
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>

                                    <Rectangle Height="60" Grid.RowSpan="2" VerticalAlignment="Top" Stroke="#FF8B9097" Fill="#FFDDEFFA"/>
                                    <Grid Name="ToolBarGrid" Margin="3,3,3,1">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="27"/>
                                            <RowDefinition Height="27"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="102"/>
                                            <ColumnDefinition Width="350"/>
                                            <ColumnDefinition Width="82"/>
                                            <ColumnDefinition Width="73"/>
                                            <ColumnDefinition Width="106"/>
                                            <ColumnDefinition Width="80"/>
                                            <ColumnDefinition Width="90"/>
                                        </Grid.ColumnDefinitions>

                                        <Rectangle Margin="0,0,0,2"  Grid.Column="0"  Grid.RowSpan="2" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4"/>
                                        <Rectangle Margin="2,0,0,2"  Grid.Column="1" Grid.RowSpan="2" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4"/>
                                        <Rectangle Margin="2,0,0,2"  Grid.Column="2" Grid.RowSpan="2" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4"/>
                                        <Rectangle Margin="2,0,0,2"  Grid.Column="3" Grid.RowSpan="2" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4"/>
                                        <Rectangle Margin="2,0,0,2"  Grid.Column="4" Grid.RowSpan="2" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4"/>
                                        <Rectangle Margin="2,0,0,2"  Grid.Column="5" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4" Grid.RowSpan="2" />
                                        <Rectangle Margin="2,0,0,2"  Grid.Column="6" Grid.RowSpan="2" RadiusX="2" RadiusY="2" Stroke="#FFA5BED4"/>

                                        <!--Clipboard Toolbar Section-->
                                        <Button x:Name="btnPaste" Click="btnPaste_Click" Width="22"  HorizontalAlignment="Left">
                                            <ToolTipService.ToolTip>
                                                <ToolTip FontSize="16" Content="Paste"/>
                                            </ToolTipService.ToolTip>
                                            <Image Source="Images/Paste_big.png"  />
                                        </Button>
                                        <Button x:Name="btnCut" Click="btnCut_Click"  HorizontalAlignment="Right" Width="22" VerticalAlignment="Bottom">
                                            <ToolTipService.ToolTip>
                                                <ToolTip FontSize="16" Content="Cut"/>
                                            </ToolTipService.ToolTip>
                                            <Image Source="Images/Cut.png" />
                                        </Button>
                                        <Button x:Name="btnCopy" Click="btnCopy_Click"  VerticalAlignment="Top"  HorizontalAlignment="Center" Width="22">
                                            <ToolTipService.ToolTip>
                                                <ToolTip FontSize="16" Content="Copy"/>
                                            </ToolTipService.ToolTip>
                                            <Image Source="Images/Copy.png" />
                                        </Button>

                                        <!--Fonts Toolbar Section-->


                                        <StackPanel Grid.Column="1" Height="22" Margin="6,5,0,0" Orientation="Horizontal" VerticalAlignment="Top">
                                            <!--Buttons-->
                                            <ToggleButton x:Name="btnBold"  Margin="0,0,1,0"  Click="btnBold_Click">
                                                <ToolTipService.ToolTip>
                                                    <ToolTip FontSize="16" Content="{Binding tooltip_Bold}"/>
                                                </ToolTipService.ToolTip>
                                                <Image Source="Images/Bold.png"/>
                                            </ToggleButton>

                                            <ToggleButton x:Name="btnItalic" Margin="0,0,1,0" Click="btnItalic_Click">
              
                                                <Image Source="Images/Italic.png"/>
                                            </ToggleButton>

                                            <ToggleButton x:Name="btnUnderline"  Margin="0,0,13,0" Click="btnUnderline_Click" >
                                                <ToolTipService.ToolTip>
                                                    <ToolTip FontSize="16" Content="Underline"/>
                                                </ToolTipService.ToolTip>
                                                <Image Source="Images/Underline.png"/>
                                            </ToggleButton>
                                            <!--Buttons-->
                                            <ComboBox x:Name="cmbFonts" FontFamily="{Binding SelectedItem.FontFamily, RelativeSource={RelativeSource Self}}" FontSize="{Binding SelectedItem.FontSize, RelativeSource={RelativeSource Self}}" DropDownClosed="cmbFonts_DropDownClosed" Height="22" VerticalAlignment="Bottom" SelectedValuePath="Content" Width="144">
                                                <ComboBoxItem Content="Arial" Tag="Arial" FontFamily="Arial" FontSize="12"/>
                                                <ComboBoxItem Content="Arial Black" Tag="Arial Black" FontFamily="Arial Black" FontSize="12"/>
                                                <ComboBoxItem Content="Calibri" Tag="Calibri" FontFamily="Calibri"  FontSize="14"/>
                                                <ComboBoxItem Content="Comic Sans MS" Tag="Comic Sans MS" FontFamily="Comic Sans MS" FontSize="12"/>
                                                <ComboBoxItem Content="Courier New" Tag="Courier New" FontFamily="Courier New" FontSize="12"/>
                                                <ComboBoxItem Content="Georgia" Tag="Georgia" FontFamily="Georgia" FontSize="12"/>
                                                <ComboBoxItem Content="Lucida Sans Unicode" Tag="Lucida Sans Unicode" FontFamily="Lucida Sans Unicode" FontSize="12"/>
                                                <ComboBoxItem Content="Portable User Interface" Tag="{x:Null}" IsSelected="True" FontFamily="Portable User Interface" FontSize="12"/>
                                                <ComboBoxItem Content="Times New Roman" Tag="Times New Roman" FontFamily="Times New Roman" FontSize="12"/>
                                                <ComboBoxItem Content="Trebuchet MS" Tag="Trebuchet MS" FontFamily="Trebuchet MS" FontSize="12"/>
                                                <ComboBoxItem Content="Verdana" Tag="Verdana" FontFamily="Verdana" FontSize="12"/>
                                                <ComboBoxItem Content="Webdings" Tag="Webdings" FontSize="12"/>
                                            </ComboBox>

                                            <ComboBox x:Name="cmbFontSizes" Width="44" FontSize="14" DropDownClosed="cmbFontSizes_DropDownClosed" HorizontalAlignment="Right" Height="22" VerticalAlignment="Bottom" SelectedValuePath="Content">
                                                <ComboBoxItem Content="8" Tag="8"/>
                                                <ComboBoxItem Content="9" Tag="9"/>
                                                <ComboBoxItem Content="10" Tag="10"/>
                                                <ComboBoxItem Content="11" Tag="11"/>
                                                <ComboBoxItem Content="12" Tag="12"/>
                                                <ComboBoxItem Content="14" Tag="14"/>
                                                <ComboBoxItem Content="16" Tag="16" IsSelected="True"/>
                                                <ComboBoxItem Content="18" Tag="18"/>
                                                <ComboBoxItem Content="20" Tag="20"/>
                                                <ComboBoxItem Content="22" Tag="22"/>
                                                <ComboBoxItem Content="24" Tag="24"/>
                                                <ComboBoxItem Content="26" Tag="26"/>
                                                <ComboBoxItem Content="28" Tag="28"/>
                                                <ComboBoxItem Content="36" Tag="36"/>
                                                <ComboBoxItem Content="48" Tag="48"/>
                                                <ComboBoxItem Content="72" Tag="72"/>
                                            </ComboBox>
                                            <ComboBox x:Name="cmbFontColors" DropDownClosed="cmbFontColors_DropDownClosed" SelectedIndex="0"  HorizontalAlignment="Right" ItemsSource="{Binding}" SelectedValuePath="Tag">
                                                <ComboBoxItem Tag="#FFFF0000">
                                                    <Rectangle Width="22" Height="14" Fill="Red" Margin="2,0,0,0" />
                                                </ComboBoxItem>
                                                <ComboBoxItem Tag="#FF008000">
                                                    <Rectangle Width="22" Height="14" Fill="Green" Margin="2,0,0,0" />
                                                </ComboBoxItem>
                                                <ComboBoxItem Tag="#FF0000FF">
                                                    <Rectangle Width="22" Height="14" Fill="Blue" Margin="2,0,0,0" />
                                                </ComboBoxItem>
                                                <ComboBoxItem Tag="#FFFFFF00">
                                                    <Rectangle Width="22" Height="14" Fill="Yellow" Margin="2,0,0,0" />
                                                </ComboBoxItem>
                                                <ComboBoxItem Tag="#FF000000" IsSelected="True">
                                                    <Rectangle Width="22" Height="14" Fill="Black" Margin="2,0,0,0" />
                                                </ComboBoxItem>
                                            </ComboBox>
                                        </StackPanel>
                                        <Button x:Name="btnHyperlink" Click="btnHyperlink_Click" Width="22" Grid.Column="2" Margin="24,-22,0,24" Grid.RowSpan="1" Grid.Row="1" HorizontalAlignment="Left">
                                            <Image Source="Images/Hyperlink_big.png" Width="22" />
                                        </Button>
                                        <Button x:Name="btnPrint" Click="btnPrint_Click" Grid.Column="3" Margin="20,-22,0,24" HorizontalAlignment="Left" Grid.Row="1">
                                            <Image Source="Images/Print_big.png" Width="22"/>
                                        </Button>
                                        <ToggleButton x:Name="btnRTL" Checked="btnRTL_Checked" Unchecked="btnRTL_Checked" Grid.Column="4" Margin="15,-22,0,24" HorizontalAlignment="Left" Grid.Row="1">
                                            <ToolTipService.ToolTip>
                                                <ToolTip FontSize="16" Content="Text Direction"/>
                                            </ToolTipService.ToolTip>
                                            <Image Source="Images/ltr.png" Width="22"/>
                                        </ToggleButton>
                                        <ToggleButton x:Name="btnRO" Checked="btnRO_Checked" Unchecked="btnRO_Checked" Grid.Column="4" Margin="53,-22,0,24" HorizontalAlignment="Left" Grid.Row="1">
                                            <Image Source="Images/edit.png" Width="21"/>
                                        </ToggleButton>
                                        <ToggleButton x:Name="btnMarkUp" Checked="btnMarkUp_Checked" Unchecked="btnMarkUp_Checked" Margin="10,-22,10,24" Grid.Column="5" Grid.Row="1" HorizontalAlignment="Left">
                                            <TextBlock FontSize="12" Text="&lt;&lt;>>"/>
                                        </ToggleButton>
                                        <StackPanel Grid.RowSpan="1" Grid.Column="6" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Right" Orientation="Horizontal" >
                                            <!--New-->
                                            <Button  x:Name="btnNew" Click="btnNew_Click" HorizontalAlignment="Left" Height="22" Margin="0,0,0,0" VerticalAlignment="Top" Width="22">
                                                <Image Source="Images/New.png"/>
                                            </Button>
                                            <!--Open Existing-->
                                            <Button  x:Name="btnOpen" Click="btnOpen_Click" HorizontalAlignment="Left" Height="22" Margin="0,0,0,4" VerticalAlignment="Top" Width="22">
                                                <Image Source="Images/Open.png"/>
                                            </Button>
                                            <!--Save Existing-->
                                            <Button x:Name="btnSave" Click="btnSave_Click" HorizontalAlignment="Left" Height="22" VerticalAlignment="Top" Width="22">
                                               
                                                <Image Source="Images/Save.png"/>
                                            </Button>

                                        </StackPanel>

                                        <TextBlock  Text="Clipboard" Grid.Column="0" Grid.Row="1"/>
                                        <TextBlock  Text="Font" Grid.Column="1" Grid.Row="1"/>
                                        <TextBlock  Text="Hyperlink" Grid.Column="2" Grid.Row="1"/>
                                        <TextBlock  Text="Print" Grid.Column="3" Grid.Row="1"/>
                                        <TextBlock  Text="Display" Grid.Column="4" Grid.Row="1"/>
                                        <TextBlock  Text="XAML" Grid.Column="5" Grid.Row="1"/>
                                        <TextBlock  Text="File" Grid.Column="6" Grid.Row="1"/>
                                    </Grid>
                                    <Grid Name="RTBGrid" Grid.Row="1">
                                        <Rectangle Fill="White" Margin="0,1,1,0">
                                            <Rectangle.Effect>
                                                <DropShadowEffect ShadowDepth="1" Direction="371" BlurRadius="7" Opacity="0.345"/>
                                            </Rectangle.Effect>
                                        </Rectangle>
                                        <RichTextBox x:Name="rtb" AllowDrop="True" BorderBrush="{x:Null}" Margin="8,10,0,8" MouseRightButtonDown="rtb_MouseRightButtonDown" MouseRightButtonUp="rtb_MouseRightButtonUp" Drop="rtb_Drop"  DragEnter="rtb_DragEnter" DragLeave="rtb_DragLeave" TextWrapping="Wrap"  VerticalScrollBarVisibility="Auto" FontSize="20" SelectionChanged="rtb_SelectionChanged" />
                                        <Canvas x:Name="highlightCanvas" IsHitTestVisible="False" Margin="8,10,0,8">
                                        </Canvas>
                                        <TextBox x:Name="xamlTb" IsTabStop="False" FontSize="20" FontFamily="Lucida Console" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Visibility="Collapsed" />
                                    </Grid>

                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
